<!-- 开发环境版本，包含了有帮助的命令行警告 -->
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>

<div id="example" v-bind:class="classObject">ddd</div>
<script>
var vm = new Vue({
	el: '#example',
	data: {
		isActive: true,
		error: null
	},
	computed: {
		classObject: function () {
			return {
				active: this.isActive && !this.error,
				'text-danger': this.error && this.error.type === 'fatal'
			}
		}
	}
})
</script>